<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\widgets\ajaxbtn\Confirm;
use yii\helpers\Url;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Article Tests';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="article-test-index">


    <p>
        <?php echo Html::a('Create Article Test', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php echo GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'title',
            'content:ntext',
            'thum_addr',
            'img_list_addr:ntext',
            // 'file_addr',
            // 'file_list_addr:ntext',
            // 'create_at',
            // 'updated_at',

            [
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view} {update} {delete}',
                'buttons' => [
                    'delete'=>function ($url, $model, $key) {
                        $confirmUrl = Confirm::widget(['url'=>Url::to(['delete','id'=>$model->id]),'tip'=>'确定删除该信息？']);
                        $str .= '<a href="javascript:'.$confirmUrl.';" target="_self"><span class="glyphicon glyphicon-trash"></span></a>';
                        return $str;
                    }
                ]
            ],
            
        ],
    ]); ?>

</div>
